package edu.tts.dao;

import java.sql.SQLException;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;

import edu.DBUtil.JdbcTemplate;
import edu.tts.domain.Order;
import edu.tts.domain.Train;

public class ReturnQueryDao {
	public List<Order> returnQueryDao(String idNumber){
		 String sql="select * from tts_orderform " + 
				 	        "where idNumber=?";
					 	   List<Order> list=JdbcTemplate.query(sql, (rs)->{
				 	        List<Order> list0=new ArrayList<>();
				 	        try {
				 	            while(rs.next()) {
				 	            	Order order0=new Order(rs.getString(1),rs.getString(2),rs.getDate(3).toLocalDate(),rs.getInt(4),rs.getBigDecimal(5));
				 	                list0.add(order0);
				 	            }
				 	        } catch (SQLException e) {
				 	            e.printStackTrace();
				 	        }
				 	        return list0;
				 	    },idNumber);
				 	    return list;
	}

}
